<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>数据统计</el-breadcrumb-item>
      <el-breadcrumb-item>数据报表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <div id="main" style="width: 600px; height: 400px"></div>
    </el-card>

    <button @click="test" style="color: red; width: 200px">测试</button>
    <quill-editor v-model="content" :options="editorOptions"></quill-editor>
  </div>
</template>
<script>
import {zxAPI} from "@/api/goods.js";
import * as echarts from "echarts";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import {quillEditor} from "vue-quill-editor";

export default {
  name: "",
  components: {
    quillEditor,
  },
  data() {
    return {
      content: "",
      editorOptions: {
        // 设置 placeholder 选项为所需的文本
        placeholder: "请输入...fff",
        // 其他选项...
      },
    };
  },
  created() {
    this.initData();
  },
  computed: {},
  methods: {
    async initData() {
      const res = await zxAPI();
      console.log(res, 888);

      var chartDom = document.getElementById("main");
      var myChart = echarts.init(chartDom);
      var option;

      option = {
        title: {
          text: "用户来源",
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#6a7985",
            },
          },
        },
        legend: {
          data: res.data.legend.data,
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
        },
        grid: {
          left: "3%",
          right: "40%",
          top: "20%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: res.data.xAxis,
        yAxis: res.data.yAxis,
        series: res.data.series,
      };

      option && myChart.setOption(option);
    },
    test() {
      console.log('hugug');
    },
  },
};
</script>
<style lang='less' scoped>
.el-card {
  margin-top: 20px;
}
</style>
